<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>EquTemper: ETVpCmd_EditSubI.cc Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="$relpath<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="$relpath<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>/search.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">EquTemper&#160;<span id="projectnumber">1.01</span></div>
   <div id="projectbrief">An equation editor.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<script type="text/javascript">
function hasClass(ele,cls) {
  return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}

function addClass(ele,cls) {
  if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}

function removeClass(ele,cls) {
  if (hasClass(ele,cls)) {
    var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
    ele.className=ele.className.replace(reg,' ');
  }
}

function toggleVisibility(linkObj) {
 var base = linkObj.getAttribute('id');
 var summary = document.getElementById(base + '-summary');
 var content = document.getElementById(base + '-content');
 var trigger = document.getElementById(base + '-trigger');
 if ( hasClass(linkObj,'closed') ) {
   summary.style.display = 'none';
   content.style.display = 'block';
   trigger.src = 'open.png';
   removeClass(linkObj,'closed');
   addClass(linkObj,'opened');
 } else if ( hasClass(linkObj,'opened') ) {
   summary.style.display = 'block';
   content.style.display = 'none';
   trigger.src = 'closed.png';
   removeClass(linkObj,'opened');
   addClass(linkObj,'closed');
 }
 return false;
}
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_e_t_vp_cmd___edit_sub_i_8cc.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">ETVpCmd_EditSubI.cc</div>  </div>
</div>
<div class="contents">
<a href="_e_t_vp_cmd___edit_sub_i_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* ========================================================================= */</span>
<a name="l00002"></a>00002 <span class="comment">/* ------------------------------------------------------------------------- */</span><span class="comment"></span>
<a name="l00003"></a>00003 <span class="comment">/*!</span>
<a name="l00004"></a>00004 <span class="comment">  \file         ETVpCmd_EditSubI.cc</span>
<a name="l00005"></a>00005 <span class="comment">  \date         Sep 2011</span>
<a name="l00006"></a>00006 <span class="comment">  \author       TNick</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment">  \brief        Contains the implementation for ETVpCmd_EditSubI class</span>
<a name="l00009"></a>00009 <span class="comment"></span>
<a name="l00010"></a>00010 <span class="comment"></span>
<a name="l00011"></a>00011 <span class="comment">  Copyright (c) 2011, Nicu Tofan</span>
<a name="l00012"></a>00012 <span class="comment"> All rights reserved.</span>
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment"> Redistribution and use in source and binary forms, with or without</span>
<a name="l00015"></a>00015 <span class="comment"> modification, are permitted provided that the following conditions are met:</span>
<a name="l00016"></a>00016 <span class="comment"> * Redistributions of source code must retain the above copyright</span>
<a name="l00017"></a>00017 <span class="comment">   notice, this list of conditions and the following disclaimer.</span>
<a name="l00018"></a>00018 <span class="comment"> * Redistributions in binary form must reproduce the above copyright</span>
<a name="l00019"></a>00019 <span class="comment">   notice, this list of conditions and the following disclaimer in the</span>
<a name="l00020"></a>00020 <span class="comment">   documentation and/or other materials provided with the distribution.</span>
<a name="l00021"></a>00021 <span class="comment"> * Neither the name of the copyright holder nor the</span>
<a name="l00022"></a>00022 <span class="comment">   names of its contributors may be used to endorse or promote products</span>
<a name="l00023"></a>00023 <span class="comment">   derived from this software without specific prior written permission.</span>
<a name="l00024"></a>00024 <span class="comment"></span>
<a name="l00025"></a>00025 <span class="comment"> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS &quot;AS IS&quot; AND</span>
<a name="l00026"></a>00026 <span class="comment"> ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</span>
<a name="l00027"></a>00027 <span class="comment"> WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</span>
<a name="l00028"></a>00028 <span class="comment"> DISCLAIMED. IN NO EVENT SHALL NICU TOFAN BE LIABLE FOR ANY</span>
<a name="l00029"></a>00029 <span class="comment"> DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES</span>
<a name="l00030"></a>00030 <span class="comment"> (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span>
<a name="l00031"></a>00031 <span class="comment"> LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</span>
<a name="l00032"></a>00032 <span class="comment"> ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span>
<a name="l00033"></a>00033 <span class="comment"> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span>
<a name="l00034"></a>00034 <span class="comment"> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00035"></a>00035 <span class="comment"></span>
<a name="l00036"></a>00036 <span class="comment">*/</span>
<a name="l00037"></a>00037 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00038"></a>00038 <span class="comment">/* ========================================================================= */</span>
<a name="l00039"></a>00039 <span class="comment">//</span>
<a name="l00040"></a>00040 <span class="comment">//</span>
<a name="l00041"></a>00041 <span class="comment">//</span>
<a name="l00042"></a>00042 <span class="comment">//</span>
<a name="l00043"></a>00043 <span class="comment">/*  INCLUDES    ------------------------------------------------------------ */</span>
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 <span class="preprocessor">#include    &lt;QMouseEvent&gt;</span>
<a name="l00046"></a>00046 
<a name="l00047"></a>00047 <span class="preprocessor">#include    &lt;<a class="code" href="_e_t_sheet_view_8h.html" title="Contains the definition for ETSheetView class.">sheet/ETSheetView.h</a>&gt;</span>
<a name="l00048"></a>00048 <span class="preprocessor">#include    &lt;<a class="code" href="_e_t_sheet_8h.html" title="Contains the definition for ETSheet class.">sheet/ETSheet.h</a>&gt;</span>
<a name="l00049"></a>00049 <span class="preprocessor">#include    &lt;<a class="code" href="_e_t_i___cplx_txt_8h.html" title="Contains the definition for ETI_CplxTxt class.">sheet/ETI_CplxTxt.h</a>&gt;</span>
<a name="l00050"></a>00050 <span class="preprocessor">#include    &lt;<a class="code" href="_e_t_s_i___s_text_8h.html" title="Contains the definition for ETSI_SText class.">sheet/subitems/ETSI_SText.h</a>&gt;</span>
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 <span class="preprocessor">#include    &quot;<a class="code" href="_e_t_vp_cmd___edit_sub_i_8h.html" title="Contains the definition for ETVpCmd_EditSubI class.">ETVpCmd_EditSubI.h</a>&quot;</span>
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 <span class="comment">/*  INCLUDES    ============================================================ */</span>
<a name="l00055"></a>00055 <span class="comment">//</span>
<a name="l00056"></a>00056 <span class="comment">//</span>
<a name="l00057"></a>00057 <span class="comment">//</span>
<a name="l00058"></a>00058 <span class="comment">//</span>
<a name="l00059"></a>00059 <span class="comment">/*  CLASS    --------------------------------------------------------------- */</span>
<a name="l00060"></a>00060 
<a name="l00061"></a>00061 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00062"></a><a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#ac8d027b404b03c90dade9b9677b76d0a">00062</a> <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#ac8d027b404b03c90dade9b9677b76d0a" title="constructor;">ETVpCmd_EditSubI::ETVpCmd_EditSubI</a>  ( <span class="keywordtype">void</span> )
<a name="l00063"></a>00063     : <a class="code" href="class_e_t_vp_command.html" title="abstract class representing prerequisites for a command running in a ETSheetView">ETVpCommand</a> ()
<a name="l00064"></a>00064 {
<a name="l00065"></a>00065     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#adf5bfab3588e59e84f959c01c92b6e17" title="associated editor">p_editor</a> = <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00066"></a>00066     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a14f25189f3ae33be1173d40cd5136c03" title="the item that we&#39;re editing">it_in_ed</a> = <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00067"></a>00067     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a> = <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00068"></a>00068     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a> = <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00069"></a>00069 
<a name="l00070"></a>00070 }
<a name="l00071"></a>00071 <span class="comment">/* ========================================================================= */</span>
<a name="l00072"></a>00072 
<a name="l00073"></a>00073 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00074"></a><a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a26880c312b6cb9dd7cc6d88e15350b0c">00074</a> <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a26880c312b6cb9dd7cc6d88e15350b0c" title="destructor;">ETVpCmd_EditSubI::~ETVpCmd_EditSubI</a> ( <span class="keywordtype">void</span> )
<a name="l00075"></a>00075 {
<a name="l00076"></a>00076 
<a name="l00077"></a>00077     <span class="keywordflow">if</span> (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#adf5bfab3588e59e84f959c01c92b6e17" title="associated editor">p_editor</a> != <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00078"></a>00078     {
<a name="l00079"></a>00079         <a class="code" href="class_ln_edit_s_i.html" title="line editor for simple text input">LnEditSI</a> * ed = <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#adf5bfab3588e59e84f959c01c92b6e17" title="associated editor">p_editor</a>;
<a name="l00080"></a>00080         <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#adf5bfab3588e59e84f959c01c92b6e17" title="associated editor">p_editor</a> = <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00081"></a>00081         ed-&gt;deleteLater();
<a name="l00082"></a>00082     }
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084 <span class="comment">/* ========================================================================= */</span>
<a name="l00085"></a>00085 
<a name="l00086"></a>00086 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00087"></a><a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a1607bf89908ee74c901fa123f96e2ec5">00087</a> <span class="keywordtype">bool</span>        <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a1607bf89908ee74c901fa123f96e2ec5" title="the class is informed that the command is starting">ETVpCmd_EditSubI::start</a>     (
<a name="l00088"></a>00088         <a class="code" href="class_e_t_sheet_view.html" title="Widget capable of displaying an ETSheet content.">ETSheetView</a> * trg_vp)
<a name="l00089"></a>00089 {
<a name="l00090"></a>00090 
<a name="l00091"></a>00091     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a> = trg_vp;
<a name="l00092"></a>00092     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a422d90d95b149f7dc32e9cdf3b9526b1" title="saved transformation for the view">transf</a> = <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;transform();
<a name="l00093"></a>00093 
<a name="l00094"></a>00094     <span class="comment">/* make shure we have a proper sub-item to edit */</span>
<a name="l00095"></a>00095     <span class="keywordflow">if</span> (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a> == <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00096"></a>00096     {
<a name="l00097"></a>00097 
<a name="l00098"></a>00098         <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a> = <span class="keyword">static_cast&lt;</span><a class="code" href="class_e_t_s_i___s_text.html" title="simple sub-item capable to display a string">ETSI_SText</a> *<span class="keyword">&gt;</span>(trg_vp-&gt;<a class="code" href="class_e_t_sheet_view.html#af772d536773e6acb31413fb6a5f8cade" title="tell which is currenly selected sub-item in this view">currentSubI</a>());
<a name="l00099"></a>00099         <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a14f25189f3ae33be1173d40cd5136c03" title="the item that we&#39;re editing">it_in_ed</a> = trg_vp-&gt;<a class="code" href="class_e_t_sheet_view.html#ace5bbf9569571e95b2cb3e4ca010ae76" title="tell which is the parent for currenly selected sub-item in this view">currentItem</a>();
<a name="l00100"></a>00100 
<a name="l00101"></a>00101         <span class="keywordflow">if</span> (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a> == <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00102"></a>00102             <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00103"></a>00103     }
<a name="l00104"></a>00104 
<a name="l00105"></a>00105     <span class="comment">/* check for proper item type */</span>
<a name="l00106"></a>00106     <span class="keywordflow">if</span> (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a>-&gt;<a class="code" href="class_e_t_s_i___s_text.html#a303de201a6e89d4a0f62b878a57a0472" title="identifies the type of the sub-item">type</a>() != <a class="code" href="class_e_t_sub_item.html#aa7307b06fe620851acea92b9b6e93ea6ab47ada72a5ab0073c8b32562eb3185d4">ETSubItem::TYSTEXT</a>)
<a name="l00107"></a>00107     {
<a name="l00108"></a>00108         qDebug() &lt;&lt; <span class="stringliteral">&quot;Can not edit an non-text item. Expected type: &quot;</span>
<a name="l00109"></a>00109                  &lt;&lt; <a class="code" href="class_e_t_sub_item.html#aa7307b06fe620851acea92b9b6e93ea6ab47ada72a5ab0073c8b32562eb3185d4">ETSubItem::TYSTEXT</a> &lt;&lt; <span class="stringliteral">&quot; recieved type: &quot;</span> &lt;&lt; <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a>-&gt;<a class="code" href="class_e_t_s_i___s_text.html#a303de201a6e89d4a0f62b878a57a0472" title="identifies the type of the sub-item">type</a>();
<a name="l00110"></a>00110 
<a name="l00111"></a>00111     }
<a name="l00112"></a>00112 
<a name="l00113"></a>00113     <span class="comment">/* cancel the rotation */</span>
<a name="l00114"></a>00114     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;rotate(-<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#af80568cd2833d1a5b16fc9967586b222" title="tell the rotation angle of this view to the scene">getRotation</a>());
<a name="l00115"></a>00115 
<a name="l00116"></a>00116     <span class="comment">/* enshure a proper zoom */</span>
<a name="l00117"></a>00117     QRectF box_in_s = <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a>-&gt;<a class="code" href="class_e_t_sub_item.html#a45d5f17e954c49f22904ee97ac04d263" title="get the bounding box of this sub-item represented in the scene">boxInScene</a>(<a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00118"></a>00118     qreal h_in_px = box_in_s.height() * <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#a1e9035cd7b62a675ee925f6ab70f4712" title="return current scale of this view to the scene">getScale</a>();
<a name="l00119"></a>00119     qreal scale_now = <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#a1e9035cd7b62a675ee925f6ab70f4712" title="return current scale of this view to the scene">getScale</a>();
<a name="l00120"></a>00120     <span class="keywordflow">if</span> (h_in_px &lt; 40)
<a name="l00121"></a>00121     {
<a name="l00122"></a>00122         qreal fact = 40 * <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#a1e9035cd7b62a675ee925f6ab70f4712" title="return current scale of this view to the scene">getScale</a>() / h_in_px;
<a name="l00123"></a>00123         <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;scale(fact, fact);
<a name="l00124"></a>00124         scale_now *= fact;
<a name="l00125"></a>00125     }
<a name="l00126"></a>00126     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (h_in_px &gt; 60)
<a name="l00127"></a>00127     {
<a name="l00128"></a>00128         qreal fact = 1 / (60 * <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#a1e9035cd7b62a675ee925f6ab70f4712" title="return current scale of this view to the scene">getScale</a>() / h_in_px);
<a name="l00129"></a>00129         <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;scale(fact, fact);
<a name="l00130"></a>00130         scale_now *= fact;
<a name="l00131"></a>00131     }
<a name="l00132"></a>00132 
<a name="l00133"></a>00133     <span class="comment">/* enshure is in visible area */</span>
<a name="l00134"></a>00134     qreal wdth_in_px = scale_now * box_in_s.width();
<a name="l00135"></a>00135     h_in_px = box_in_s.height() * scale_now;
<a name="l00136"></a>00136 
<a name="l00137"></a>00137     QPointF tp_l_px(
<a name="l00138"></a>00138                 box_in_s.left() * <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#a1e9035cd7b62a675ee925f6ab70f4712" title="return current scale of this view to the scene">getScale</a>(),
<a name="l00139"></a>00139                 box_in_s.top() * <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#a1e9035cd7b62a675ee925f6ab70f4712" title="return current scale of this view to the scene">getScale</a>());
<a name="l00140"></a>00140     <span class="keywordtype">bool</span> b_pop_up = <span class="keyword">false</span>;
<a name="l00141"></a>00141     <span class="keywordtype">int</span> dx = 0;
<a name="l00142"></a>00142     <span class="keywordtype">int</span> dy = 0;
<a name="l00143"></a>00143     <span class="keywordflow">for</span> (;;)
<a name="l00144"></a>00144     {
<a name="l00145"></a>00145         <span class="comment">/* first, make shure that the the area is large enough to contain</span>
<a name="l00146"></a>00146 <span class="comment">   entire box */</span>
<a name="l00147"></a>00147         <span class="keywordflow">if</span> (h_in_px &gt; <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;height() )
<a name="l00148"></a>00148         { <span class="comment">/* the height is limitative factor; step to pop-up box directly */</span>
<a name="l00149"></a>00149             b_pop_up = <span class="keyword">true</span>;
<a name="l00150"></a>00150             <span class="keywordflow">break</span>;
<a name="l00151"></a>00151         }
<a name="l00152"></a>00152         <span class="keywordflow">if</span> (wdth_in_px &lt; 30)
<a name="l00153"></a>00153             wdth_in_px = 30;
<a name="l00154"></a>00154 
<a name="l00155"></a>00155         <span class="keywordflow">if</span> (wdth_in_px &gt; <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;width())
<a name="l00156"></a>00156         { <span class="comment">/* we have a box that is larger than the viewport */</span>
<a name="l00157"></a>00157 
<a name="l00158"></a>00158             <span class="keywordflow">if</span> (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;width() &lt; 100)
<a name="l00159"></a>00159             { <span class="comment">/* the viewport is too small; use a text box */</span>
<a name="l00160"></a>00160                 b_pop_up = <span class="keyword">true</span>;
<a name="l00161"></a>00161                 <span class="keywordflow">break</span>;
<a name="l00162"></a>00162             }
<a name="l00163"></a>00163             <span class="keywordflow">else</span>
<a name="l00164"></a>00164             { <span class="comment">/* the viewport is large enough. Shrink the box */</span>
<a name="l00165"></a>00165                 wdth_in_px = (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;width() * 100) / 128;
<a name="l00166"></a>00166             }
<a name="l00167"></a>00167         }
<a name="l00168"></a>00168 
<a name="l00169"></a>00169         <span class="comment">/* we now know that the box fits inside the viewport */</span>
<a name="l00170"></a>00170         <span class="comment">//viwp-&gt;ensureVisible(box_in_s);</span>
<a name="l00171"></a>00171 
<a name="l00172"></a>00172         <span class="comment">/* check vertical position */</span>
<a name="l00173"></a>00173         <span class="keywordflow">if</span> (tp_l_px.y() &lt; 0)
<a name="l00174"></a>00174         { <span class="comment">/* the box is above the view */</span>
<a name="l00175"></a>00175             dy = (int)(tp_l_px.y() - <span class="comment">/* this brings the box to top margin */</span>
<a name="l00176"></a>00176                        (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;height() - h_in_px) / 2); <span class="comment">/* and this centers it */</span>
<a name="l00177"></a>00177         }
<a name="l00178"></a>00178         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (tp_l_px.y() &gt; (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;height() - h_in_px))
<a name="l00179"></a>00179         { <span class="comment">/* the box is below the view */</span>
<a name="l00180"></a>00180             dy = (int)(tp_l_px.y() - <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;height() -<span class="comment">/* brig it to bottom margin */</span>
<a name="l00181"></a>00181                        (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;height() - h_in_px) / 2); <span class="comment">/* and this centers it */</span>
<a name="l00182"></a>00182         }
<a name="l00183"></a>00183 
<a name="l00184"></a>00184         <span class="comment">/* check horizontal position */</span>
<a name="l00185"></a>00185         <span class="keywordflow">if</span> (tp_l_px.x() &lt; 0)
<a name="l00186"></a>00186         { <span class="comment">/* the box is to the left of the view */</span>
<a name="l00187"></a>00187             dx = (int)(tp_l_px.x() - <span class="comment">/* this brings the box to left margin */</span>
<a name="l00188"></a>00188                        (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;width() - wdth_in_px) / 2); <span class="comment">/* and this centers it */</span>
<a name="l00189"></a>00189         }
<a name="l00190"></a>00190         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (tp_l_px.x() &gt; (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;width() - wdth_in_px))
<a name="l00191"></a>00191         { <span class="comment">/* the box is to the right of the view */</span>
<a name="l00192"></a>00192             dx = (int)(tp_l_px.x() - <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;width() -<span class="comment">/* brig it to right margin */</span>
<a name="l00193"></a>00193                        (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;width() - wdth_in_px) / 2); <span class="comment">/* and this centers it */</span>
<a name="l00194"></a>00194 
<a name="l00195"></a>00195         }
<a name="l00196"></a>00196         <span class="keywordflow">break</span>;
<a name="l00197"></a>00197     }
<a name="l00198"></a>00198 
<a name="l00199"></a>00199     <span class="keywordflow">if</span> (b_pop_up)
<a name="l00200"></a>00200     { <span class="comment">/* create a pop-up text box that will handle the input */</span>
<a name="l00201"></a>00201 
<a name="l00202"></a>00202     }
<a name="l00203"></a>00203     <span class="keywordflow">else</span>
<a name="l00204"></a>00204     {
<a name="l00205"></a>00205         <span class="keywordflow">if</span> ((dx != 0) | (dy != 0))
<a name="l00206"></a>00206         { <span class="comment">/* translation is needed */</span>
<a name="l00207"></a>00207             <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#a6aae6386fb887c134c91268d37521422" title="sneak in to see what&#39;s up">translate</a>(
<a name="l00208"></a>00208                         dx / <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#a1e9035cd7b62a675ee925f6ab70f4712" title="return current scale of this view to the scene">getScale</a>(),
<a name="l00209"></a>00209                         dy / <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#a1e9035cd7b62a675ee925f6ab70f4712" title="return current scale of this view to the scene">getScale</a>()
<a name="l00210"></a>00210                         );
<a name="l00211"></a>00211         }
<a name="l00212"></a>00212 
<a name="l00213"></a>00213         <span class="comment">/* create the editor */</span>
<a name="l00214"></a>00214         QRect   ed_r(
<a name="l00215"></a>00215                     (<span class="keywordtype">int</span>)tp_l_px.x()+dx,
<a name="l00216"></a>00216                     (int)tp_l_px.y()+dy,
<a name="l00217"></a>00217                     wdth_in_px,
<a name="l00218"></a>00218                     h_in_px);
<a name="l00219"></a>00219         <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#adf5bfab3588e59e84f959c01c92b6e17" title="associated editor">p_editor</a> = <span class="keyword">new</span> <a class="code" href="class_ln_edit_s_i.html" title="line editor for simple text input">LnEditSI</a> (
<a name="l00220"></a>00220                     <span class="keyword">this</span>,
<a name="l00221"></a>00221                     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a>-&gt;<a class="code" href="class_e_t_s_i___s_text.html#a80623f0dd2569d964f725fcddaf964bb" title="retrieve the displayed text; if in default state the string is empty">text</a>(),
<a name="l00222"></a>00222                     ed_r, trg_vp);
<a name="l00223"></a>00223 
<a name="l00224"></a>00224         QFont f_lc = <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a>-&gt;<a class="code" href="class_e_t_sub_item.html#a272d8d9d868d76ec81cf4ec697d2639e" title="default font">font</a>();
<a name="l00225"></a>00225         f_lc.setPointSize(f_lc.pointSize() * <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;<a class="code" href="class_e_t_sheet_view.html#a1e9035cd7b62a675ee925f6ab70f4712" title="return current scale of this view to the scene">getScale</a>());
<a name="l00226"></a>00226         p_editor-&gt;setFont(f_lc);
<a name="l00227"></a>00227     }
<a name="l00228"></a>00228 
<a name="l00229"></a>00229     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00230"></a>00230 }
<a name="l00231"></a>00231 <span class="comment">/* ========================================================================= */</span>
<a name="l00232"></a>00232 
<a name="l00233"></a>00233 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00234"></a><a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#aa6adbc6924f7c6bfdd3e725a2de5ff2f">00234</a> <span class="keywordtype">void</span>        <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#aa6adbc6924f7c6bfdd3e725a2de5ff2f" title="the class is informed that the command is being canceled">ETVpCmd_EditSubI::cancel</a>        (
<a name="l00235"></a>00235         <a class="code" href="class_e_t_sheet_view.html" title="Widget capable of displaying an ETSheet content.">ETSheetView</a> * trg_vp )
<a name="l00236"></a>00236 {
<a name="l00237"></a>00237     Q_UNUSED(trg_vp);
<a name="l00238"></a>00238 
<a name="l00239"></a>00239     <span class="comment">/* restore the view matrix */</span>
<a name="l00240"></a>00240     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a5e60d515d2ad9a59a5a01ef2e0e82261" title="the viewport that we&#39;re editing">viwp</a>-&gt;setTransform(<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a422d90d95b149f7dc32e9cdf3b9526b1" title="saved transformation for the view">transf</a>);
<a name="l00241"></a>00241 
<a name="l00242"></a>00242     <span class="comment">/* destroy the editor */</span>
<a name="l00243"></a>00243     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#adf5bfab3588e59e84f959c01c92b6e17" title="associated editor">p_editor</a>-&gt;close();
<a name="l00244"></a>00244     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#adf5bfab3588e59e84f959c01c92b6e17" title="associated editor">p_editor</a>-&gt;deleteLater();
<a name="l00245"></a>00245 
<a name="l00246"></a>00246 }
<a name="l00247"></a>00247 <span class="comment">/* ========================================================================= */</span>
<a name="l00248"></a>00248 
<a name="l00249"></a>00249 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00250"></a><a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#ac704fb84ec5a9867aa44ae7d2e3065e1">00250</a> <span class="keywordtype">void</span>        <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#ac704fb84ec5a9867aa44ae7d2e3065e1" title="the class is informed that the command is being accepted">ETVpCmd_EditSubI::accepted</a>      (
<a name="l00251"></a>00251         <a class="code" href="class_e_t_sheet_view.html" title="Widget capable of displaying an ETSheet content.">ETSheetView</a> * trg_vp )
<a name="l00252"></a>00252 {
<a name="l00253"></a>00253     Q_UNUSED(trg_vp);
<a name="l00254"></a>00254 
<a name="l00255"></a>00255     <span class="comment">/* save the text */</span>
<a name="l00256"></a>00256     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a>-&gt;<a class="code" href="class_e_t_s_i___s_text.html#ada9eb6b82d7e8d8725afa5dbdcfeb8bd" title="change the displayed text">setText</a>(<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#adf5bfab3588e59e84f959c01c92b6e17" title="associated editor">p_editor</a>-&gt;text());
<a name="l00257"></a>00257 }
<a name="l00258"></a>00258 <span class="comment">/* ========================================================================= */</span>
<a name="l00259"></a>00259 
<a name="l00260"></a>00260 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00261"></a><a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#aa70566ffebd1ca876d2eca56172c73c7">00261</a> <span class="keywordtype">void</span>        <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#aa70566ffebd1ca876d2eca56172c73c7" title="called before start() to set the item that&#39;s being edited">ETVpCmd_EditSubI::setSubItemToEdit</a>  (
<a name="l00262"></a>00262         <a class="code" href="class_e_t_i___cplx_txt.html" title="class representing a complex text; this may or may not represent an equation">ETI_CplxTxt</a> * new_it_in_ed, <a class="code" href="class_e_t_s_i___s_text.html" title="simple sub-item capable to display a string">ETSI_SText</a> * new_sit_in_ed)
<a name="l00263"></a>00263 {
<a name="l00264"></a>00264     <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a> = new_sit_in_ed;
<a name="l00265"></a>00265     <span class="keywordflow">if</span> (new_it_in_ed == <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00266"></a>00266     {
<a name="l00267"></a>00267         <span class="keywordflow">if</span> (<a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a> == <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00268"></a>00268         {
<a name="l00269"></a>00269             <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a14f25189f3ae33be1173d40cd5136c03" title="the item that we&#39;re editing">it_in_ed</a> = <a class="code" href="aclass__ddhc_8cc.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00270"></a>00270         }
<a name="l00271"></a>00271         <span class="keywordflow">else</span>
<a name="l00272"></a>00272         {
<a name="l00273"></a>00273             <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a14f25189f3ae33be1173d40cd5136c03" title="the item that we&#39;re editing">it_in_ed</a> = <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a23981df52c0e371f2d8c65aa92d7ae5a" title="the sub-item that is being edited">sit_in_ed</a>-&gt;<a class="code" href="class_e_t_sub_item.html#a73078f093b83442fb1729f6f35bee29f" title="get the ETI_CplxTxt father (complex text)">fatherCplx</a>();
<a name="l00274"></a>00274         }
<a name="l00275"></a>00275     }
<a name="l00276"></a>00276     <span class="keywordflow">else</span>
<a name="l00277"></a>00277     {
<a name="l00278"></a>00278         <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#a14f25189f3ae33be1173d40cd5136c03" title="the item that we&#39;re editing">it_in_ed</a> = new_it_in_ed;
<a name="l00279"></a>00279     }
<a name="l00280"></a>00280 }
<a name="l00281"></a>00281 <span class="comment">/* ========================================================================= */</span>
<a name="l00282"></a>00282 
<a name="l00283"></a>00283 
<a name="l00284"></a>00284 
<a name="l00285"></a>00285 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00286"></a><a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#af2460956187c96ea18ca7e41cad7432a">00286</a> <span class="keywordtype">bool</span>        <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html#af2460956187c96ea18ca7e41cad7432a">ETVpCmd_EditSubI::mousePress</a>    (
<a name="l00287"></a>00287         <a class="code" href="class_e_t_sheet_view.html" title="Widget capable of displaying an ETSheet content.">ETSheetView</a> * vp, QMouseEvent * event)
<a name="l00288"></a>00288 {
<a name="l00289"></a>00289     Q_UNUSED(event);
<a name="l00290"></a>00290 
<a name="l00291"></a>00291     <a class="code" href="class_e_t_sheet.html" title="Class representing logical root for all elements contained in a document (sheet)">ETSheet</a> * scn = <span class="keyword">static_cast&lt;</span><a class="code" href="class_e_t_sheet.html" title="Class representing logical root for all elements contained in a document (sheet)">ETSheet</a> *<span class="keyword">&gt;</span>(vp-&gt;scene());
<a name="l00292"></a>00292     Q_UNUSED(scn);
<a name="l00293"></a>00293 
<a name="l00294"></a>00294     <span class="comment">/* end the command, suggesting succesfull completion */</span>
<a name="l00295"></a>00295     vp-&gt;<a class="code" href="class_e_t_sheet_view.html#ab6198569e016ba77703883a0472d69d7" title="stops current running command but ETCommand::accepted() is caled before">acceptCommand</a>();
<a name="l00296"></a>00296 
<a name="l00297"></a>00297     <span class="comment">/* allow the event to do it&#39;s job */</span>
<a name="l00298"></a>00298     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00299"></a>00299 }
<a name="l00300"></a>00300 <span class="comment">/* ========================================================================= */</span>
<a name="l00301"></a>00301 
<a name="l00302"></a>00302 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00303"></a><a class="code" href="class_ln_edit_s_i.html#a686dff5fdaf3144172ce44be0f4fc2a8">00303</a> <a class="code" href="class_ln_edit_s_i.html#a686dff5fdaf3144172ce44be0f4fc2a8" title="constructor; prepares and shows the editor">LnEditSI::LnEditSI</a>          (
<a name="l00304"></a>00304         <a class="code" href="class_e_t_vp_cmd___edit_sub_i.html" title="viewport command that edits an sub-item">ETVpCmd_EditSubI</a> * ed_req, QString s_tx,
<a name="l00305"></a>00305         QRect geom, <a class="code" href="class_e_t_sheet_view.html" title="Widget capable of displaying an ETSheet content.">ETSheetView</a> * parent)
<a name="l00306"></a>00306     : QLineEdit(parent)
<a name="l00307"></a>00307 {
<a name="l00308"></a>00308     <span class="comment">/* cache provided data */</span>
<a name="l00309"></a>00309     <a class="code" href="class_ln_edit_s_i.html#a4ffed900e53daf070764f5a719da265f" title="associated class instance that gets notified about events">requester</a> = ed_req;
<a name="l00310"></a>00310 
<a name="l00311"></a>00311     <span class="comment">/* move in place */</span>
<a name="l00312"></a>00312     move(geom.topLeft());
<a name="l00313"></a>00313     resize(geom.size());
<a name="l00314"></a>00314 
<a name="l00315"></a>00315     <span class="comment">/* set the string as requested */</span>
<a name="l00316"></a>00316     setText(s_tx);
<a name="l00317"></a>00317 
<a name="l00318"></a>00318     <span class="comment">/* bright and shiny */</span>
<a name="l00319"></a>00319     show();
<a name="l00320"></a>00320     setFocus();
<a name="l00321"></a>00321 }
<a name="l00322"></a>00322 <span class="comment">/* ========================================================================= */</span>
<a name="l00323"></a>00323 
<a name="l00324"></a>00324 
<a name="l00325"></a>00325 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00326"></a><a class="code" href="class_ln_edit_s_i.html#a145ded952e72a7ba2a85e24a0ba4f5ed">00326</a> <span class="keywordtype">void</span>        <a class="code" href="class_ln_edit_s_i.html#a145ded952e72a7ba2a85e24a0ba4f5ed" title="filter Return and Escape keys">LnEditSI::keyPressEvent</a>     ( QKeyEvent * event )
<a name="l00327"></a>00327 {
<a name="l00328"></a>00328     <span class="keywordflow">if</span> (event-&gt;key() == Qt::Key_Return)
<a name="l00329"></a>00329     {
<a name="l00330"></a>00330         <a class="code" href="class_e_t_sheet_view.html" title="Widget capable of displaying an ETSheet content.">ETSheetView</a> * vp = <span class="keyword">static_cast&lt;</span><a class="code" href="class_e_t_sheet_view.html" title="Widget capable of displaying an ETSheet content.">ETSheetView</a> *<span class="keyword">&gt;</span>(parent());
<a name="l00331"></a>00331         vp-&gt;<a class="code" href="class_e_t_sheet_view.html#ab6198569e016ba77703883a0472d69d7" title="stops current running command but ETCommand::accepted() is caled before">acceptCommand</a>();
<a name="l00332"></a>00332     }
<a name="l00333"></a>00333     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (event-&gt;key() == Qt::Key_Escape)
<a name="l00334"></a>00334     {
<a name="l00335"></a>00335         <a class="code" href="class_e_t_sheet_view.html" title="Widget capable of displaying an ETSheet content.">ETSheetView</a> * vp = <span class="keyword">static_cast&lt;</span><a class="code" href="class_e_t_sheet_view.html" title="Widget capable of displaying an ETSheet content.">ETSheetView</a> *<span class="keyword">&gt;</span>(parent());
<a name="l00336"></a>00336         vp-&gt;<a class="code" href="class_e_t_sheet_view.html#a4717e93e01e82f791945007293c0a5f2" title="cancels currently running command">cancelCommand</a>();
<a name="l00337"></a>00337     }
<a name="l00338"></a>00338     <span class="keywordflow">else</span>
<a name="l00339"></a>00339     {
<a name="l00340"></a>00340         <a class="code" href="class_ln_edit_s_i.html#a145ded952e72a7ba2a85e24a0ba4f5ed" title="filter Return and Escape keys">QLineEdit::keyPressEvent</a>(event);
<a name="l00341"></a>00341     }
<a name="l00342"></a>00342 }
<a name="l00343"></a>00343 <span class="comment">/* ========================================================================= */</span>
<a name="l00344"></a>00344 
<a name="l00345"></a>00345 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00346"></a><a class="code" href="class_ln_edit_s_i.html#a4f1522c8a0dc2054f24d0b6ae3aaa5e4">00346</a> <span class="keywordtype">void</span>        <a class="code" href="class_ln_edit_s_i.html#a4f1522c8a0dc2054f24d0b6ae3aaa5e4" title="based on options, this may tigger a close">LnEditSI::focusOutEvent</a>     ( QFocusEvent * e )
<a name="l00347"></a>00347 {<span class="comment"></span>
<a name="l00348"></a>00348 <span class="comment">    /// @todo implement the options for focus lost</span>
<a name="l00349"></a>00349 <span class="comment"></span>
<a name="l00350"></a>00350     <span class="comment">//  if (option_to_accept_when_focus_is_lost == true)</span>
<a name="l00351"></a>00351     <span class="comment">//  {</span>
<a name="l00352"></a>00352     <span class="comment">//  ETSheetView * vp = static_cast&lt;ETSheetView *&gt;(parent());</span>
<a name="l00353"></a>00353     <span class="comment">//  vp-&gt;acceptCommand();</span>
<a name="l00354"></a>00354     <span class="comment">//  }</span>
<a name="l00355"></a>00355     <span class="comment">//  else if (option_to_cancel_when_focus_is_lost == true)</span>
<a name="l00356"></a>00356     <span class="comment">//  {</span>
<a name="l00357"></a>00357     <span class="comment">//  ETSheetView * vp = static_cast&lt;ETSheetView *&gt;(parent());</span>
<a name="l00358"></a>00358     <span class="comment">//  vp-&gt;cancelCommand();</span>
<a name="l00359"></a>00359     <span class="comment">//  }</span>
<a name="l00360"></a>00360 
<a name="l00361"></a>00361     <a class="code" href="class_ln_edit_s_i.html#a4f1522c8a0dc2054f24d0b6ae3aaa5e4" title="based on options, this may tigger a close">QLineEdit::focusOutEvent</a>(e);
<a name="l00362"></a>00362 }
<a name="l00363"></a>00363 <span class="comment">/* ========================================================================= */</span>
<a name="l00364"></a>00364 
<a name="l00365"></a>00365 
<a name="l00366"></a>00366 <span class="comment">/*  CLASS    =============================================================== */</span>
<a name="l00367"></a>00367 <span class="comment">//</span>
<a name="l00368"></a>00368 <span class="comment">//</span>
<a name="l00369"></a>00369 <span class="comment">//</span>
<a name="l00370"></a>00370 <span class="comment">//</span>
<a name="l00371"></a>00371 <span class="comment">/* ------------------------------------------------------------------------- */</span>
<a name="l00372"></a>00372 <span class="comment">/* ========================================================================= */</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_e_t_vp_cmd___edit_sub_i_8cc.html">ETVpCmd_EditSubI.cc</a>      </li>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

    <li class="footer">Generated on Sun Oct 23 2011 22:06:48 for EquTemper by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li>
   </ul>
 </div>
</body>
</html>
